<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <form class="form-horizontal" action="{:U('update')}" method="post">
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-10">
                                    上级菜单 </label>
                                <div class="col-sm-9">
                                    <select id="parent_id" name="poster[parent_id]" class="rcol-xs-10 col-sm-5">
                                        <volist name="list" id="v">
                                            <option value="1-{$v.id}" <eq name="v.id" value="$currentmenu['menus_id']">selected</eq>>{$v['title']}</option>
                                            <volist name="v.list" id="vv">
                                                <option value="2-{$vv.id}" <eq name="vv.id" value="$currentmenu['actions_id']">selected</eq>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-----{$vv['title']}</option>
                                                <foreach name="vv.list" item="vvv">
                                                    <option value="3-{$vv.id}-{$vvv.id}" <eq name="vvv.id" value="$currentmenu['parent_id']">selected</eq>>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-----{$vvv['title']}</option>
                                                </foreach>
                                            </volist>
                                        </volist>
                                    </select>
                                    <span class="help-inline col-xs-12 col-sm-7">
                                            <span class="middle"></span>
                                    </span>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-1"> 菜单名称 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[title]" id="title" class="rcol-xs-10 col-sm-5" value="{$currentmenu.title}">
                                    <span class="help-inline col-xs-12 col-sm-7">
                                            <span class="middle"></span>
                                    </span>
                                </div>
                            </div>
							
							<span id="input_2" <notempty name="currentmenu.style_class_name">style="display:none"</notempty>>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2"> 链接 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[url]" id="url" placeholder="链接，如：Index/index" class="col-xs-10 col-sm-5" value="{$currentmenu.url}">
                                    <span class="help-inline col-xs-12 col-sm-7">
										<span class="middle"></span>
									</span>
                                </div>
                            </div>
							</span>
							
							<span id="input_1" <notempty name="currentmenu.url">style="display:none"</notempty>>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2">
                                    ICON图标 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[style_class_name]" id="style_class_name" placeholder="ICON图标" class="col-xs-10 col-sm-5" value="{$currentmenu.style_class_name}">
                                    <span class="help-inline col-xs-12 col-sm-7">
										<span class="middle"></span>
									</span>
                                </div>
                            </div>
							</span>
							
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2"> 显示状态 </label>
                                <div class="control-label no-padding-left col-sm-1">
                                    <label>
                                        <input name="poster[is_show]" id="is_show" value="1" checked class="ace ace-switch ace-switch-2"<eq name="currentmenu.is_show" value="1">checked</eq>  type="checkbox" />
                                        <span class="lbl"></span>
                                    </label>
                                </div>
                                <span class="help-inline col-xs-12 col-sm-7">
										<span class="middle"></span>
								</span>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2"> 排序 </label>
                                <div class="col-sm-9">
                                    <input type="text" name="poster[sort]" id="sort" placeholder="" class="col-xs-10 col-sm-5" value="{$currentmenu.sort}">
                                    <span class="help-inline col-xs-12 col-sm-7">
										<span class="middle">越大越靠前</span>
									</span>
                                </div>
                            </div>
                            <div class="space-4"></div>
                            <div class="form-group">
                                <label class="col-sm-1 control-label no-padding-right" for="form-field-2"> 备注</label>
                                <div class="col-sm-9">
                                    <textarea name="poster[note]" id="note" placeholder="备注" class="col-xs-10 col-sm-5" ows="5">{$currentmenu.note}</textarea>
                                    <span class="help-inline col-xs-12 col-sm-7">
										<span class="middle"></span>
									</span>
                                </div>
                            </div>

                            <div class="space-4"></div>
                            <div class="col-md-offset-1 col-md-9">
								<input type="hidden" value="{$currentmenu.id}" name="poster[id]" />
                                <button class="btn btn-info" type="submit">
                                    <i class="icon-ok bigger-110"></i>
                                    提交
                                </button>
                            </div>
                        </form>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
		$('#parent_id').change(function(){
			var val = $(this).val().split('-');
			$( '#input_' + ( val[0] != 1 ? 2 : 1 ) ).show();
			$( '#input_' + ( val[0] == 1 ? 2 : 1 ) ).hide();
		});
        $(".btn.btn-info").click(function () {
            var title = $("#title").val();
            if (title == '') {
                bootbox.alert({
                    buttons: {
                        ok: {
                            label: '确定',
                            className: 'btn-myStyle'
                        }
                    },
                    message: '菜单名称不能为空。',
                    title: "友情提示",
                });
                return false;
            }

        })
    })
</script>

</body>
</html>
